export const IS_DEV = process.env.NODE_ENV !== 'production'

class Loading {
  constructor () {
    this.count = 0
    this.stauts = false
  }
  init () {
    let div = document.querySelector('.loading')
    console.log(div)
    if (div) {
      div.style.display = this.stauts ? 'block' : 'none'
    } else {
      let loading = document.createElement('div')
      loading.className = 'loading'
      let icon = document.createElement('i')
      icon.className = 'fa fa-spinner fa-pulse fa-5x fa-fw'
      loading.appendChild(icon)
      document.body.appendChild(loading)
    }
  }
  show () {
    this.stauts = true
    this.init()
  }
  hide () {
    this.stauts = false
    this.init()
  }
}

let loading = new Loading()
loading.init()
export default loading
